package com.xuduo.amd.service.impl;

import com.xuduo.amd.dao.EamUserDao;
import com.xuduo.amd.entity.EamUserEntity;
import com.xuduo.amd.service.EamUserService;
import org.apache.shiro.util.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class EamUserServiceImpl implements EamUserService {

    @Autowired(required = false)
    private EamUserDao eamUserDao;
    @Override
    public boolean login(String username, String password) {
        boolean result=false;
        List<EamUserEntity> list=eamUserDao.login(username,password);
        if (!CollectionUtils.isEmpty(list)){
            result=list.stream().anyMatch(entity->username.equals(entity.getUsername())&&password.equals(entity.getPassword()));
        }


        return result;
    }
}
